<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新增客户信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/admin/css/input1.css"/>
<script src="${pageContext.request.contextPath }/admin/js/reg.js"></script>
<c:choose>
	<c:when test="${stationid eq null }"><script>var sid=-1;</script></c:when>
	<c:otherwise><script>var sid=${stationid};</script></c:otherwise>
</c:choose>
<script>
	$(function(){
		// 用户角色列表
		$('#role').combobox({
			valueField:'dict_code',
			textField:'dict_name',
			url:'${pageContext.request.contextPath }/admin/user/findRoles'
			
		});
		$('#role').combobox("setValue","${userinfo.ROLE}");
		$("#init_pass").textbox('readonly',true);//设置只读 
		$("a[name='qsave']").linkbutton({text:'保存客户信息',plain:true,iconCls:'icon-ok'});
		
	});
	
	function doSub(){
		var cname=$('#cname').val();
		if($.trim(cname)==''){
			$.messager.alert('系统消息','<span style="color:red;">客户姓名必须输入！</span>');
			$('#cname').textbox('textbox').focus(); 
    		return;
		}
		var mobile=$('#mobile').val();
		if(!isValidMobilePhone(mobile)){
			$.messager.alert('系统消息','<span style="color:red;">电话号码必须输入，且必须是11位数字！</span>'); 
			return;
    	}
    	var role=$('#role').combobox("getValue");
		if(role==-1){
			$.messager.alert('系统消息','<span style="color:red;">用户角色必须选择！</span>');
			return;
		}
		$('#addCustomer').submit();
	}
	
	// 得到6位数字的随机密码
	function getRandomPass(){
		var pass="";
		for(var i=0;i<6;i++){
			pass=pass+Math.ceil(Math.random()*(10)-1);
		}
		return pass;
	}
</script>
</head>

<body>
<form method="post" id="addCustomer" action="${pageContext.request.contextPath }/admin/user/editUser">
<div class="i-container" style="width:1000px;">
	<div class="i-common i-title">编辑用户信息
		<span style="color:red; margin-left:30px;">${addMsg }</span>
		<div class="i-btn"><a id="btn" href="javascript:doSub()" name="qsave"></a></div><div style=" clear:both;"></div>
	</div>
    <div class="i-common i-cnt-left">用户名：</div><div class="i-common i-cnt-right">
    	<input name="userinfo.USERNAME" id="cname" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.USERNAME }"/>
    	<input type="hidden" name="userinfo.USERID" value="${userinfo.USERID }"/>
    	<input type="hidden" name="userinfo.PASSWORD" value="${userinfo.PASSWORD }"/>
    	<input type="hidden" name="userinfo.CREATE_TIME" value="${userinfo.CREATE_TIME }"/>
    	<input type="hidden" name="userinfo.IS_CANCEL" value="${userinfo.IS_CANCEL }"/>
    </div>
    <div class="i-common i-cnt-middle">性别：</div>
    <div class="i-common i-cnt-right">
    	
    	<input type="radio" name="userinfo.SEX" value='0' <c:if test="${userinfo.SEX eq 0 }">checked="checked"</c:if>/>男&nbsp;&nbsp;&nbsp;
    	<input type="radio" name="userinfo.SEX" value='1' <c:if test="${userinfo.SEX eq 1 }">checked="checked"</c:if>/>女
    </div>
    <div class="i-common i-cnt-middle">初始密码：</div>
    <div class="i-common i-cnt-right">
    	<input name="userinfo.INIT_PASS" id="init_pass" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.INIT_PASS }"/>
    </div>
    <div style="clear:both;"></div>
    <div class="i-common i-cnt-left">手机号码：</div>
    <div class="i-common i-cnt-right">
    	<input name="userinfo.MOBILE" id="mobile" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.MOBILE }"/>
    </div>
    <div class="i-common i-cnt-middle">QQ：</div>
    <div class="i-common i-cnt-right">
    	<input name="userinfo.QQ" id="qq" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.QQ }"/>
    </div>
    <div class="i-common i-cnt-middle">EMAIL：</div>
    <div class="i-common i-cnt-right">
    	<input name="userinfo.EMAIL" id="email" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.EMAIL }"/>
    </div>
    <div style="clear:both;"></div> 
    <div class="i-common i-cnt-left">微信号：</div>
    <div class="i-common i-cnt-right">
		<input name="userinfo.WX" id="wx" class="easyui-textbox" style="width:210px;height:26px" value="${userinfo.WX }"/>
	</div>
    <div class="i-common i-cnt-middle">用户角色：</div>
    <div class="i-common i-cnt-right">
    	<input name="userinfo.ROLE" id="role" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">用户状态：</div>
    <div class="i-common i-cnt-right">
    	<input type="radio" name="userinfo.ENABLE" value='1' <c:if test="${userinfo.ENABLE eq 1 }">checked="checked"</c:if>/>正常使用&nbsp;&nbsp;&nbsp;
    	<input type="radio" name="userinfo.ENABLE" value='0' <c:if test="${userinfo.ENABLE eq 0 }">checked="checked"</c:if>/>禁止使用
    </div>
    <div style="clear:both;"></div>
</div>

</form>
</body>
</html>
